# encoding=utf-8
from LBT.BaseParent.BaseLbt import lbtlogin
from LBT.Resource.SchoolStationAtt import SchoolStationAtt
from bs4 import BeautifulSoup


class SchoolEducation(lbtlogin, SchoolStationAtt):
    """特色教育模块
    1、查看页面加载内容和数据库是否一致。
    """

    @lbtlogin.loginFun
    def test_checkEducationText(self):
        """
        查看页面加载内容和数据库是否一致。
        :return:
        """
        self.docstr = '查看页面加载内容和数据库是否一致。'
        dr = self.driver
        self.moduleOp.openMoudleAndIn(self.schoolstation_navigation_class, self.schoolstation_educationinfo_url)
        dr.switch_to.frame(self.schoolstation_education_textframe_id)
        pageinfo = dr.page_source
        # 只取body里面的内容去和数据库比对
        pageinfo = \
            pageinfo.split(self.schoolstation_education_split_list[0])[1].split(
                self.schoolstation_education_split_list[1])[
                0]
        sql = "select SchoolIntro from School where schoolname = '" + self.lbt_schoolname_text + "'"
        querytext = self.selectlbt(sql)
        querytext = BeautifulSoup(querytext).get_text().replace(" ", "")
        pageinfo = BeautifulSoup(pageinfo).get_text().replace(" ", "")
        self.assertTrue(querytext == pageinfo)
